package com.yuw.oop;

public class Teacher {
	// 属性
	private String teaName;
	private int teaAge;
	private String teaSex;
	private String courseName;

	

	// 构造方法
	
	/**
	 * 自定义的构造方法
	 * @param teaName
	 * @param teaAge
	 * @param teaSex
	 * @param courseName
	 */
	public Teacher(String teaName, int teaAge, String teaSex, String courseName) {
		//调用默认的构造方法
		//this调用构造方法时，需要方法在首行
		this();
		System.out.println("执行力带有四个参数的自定义的构造方法。。。");
		this.teaName = teaName;
		this.teaAge = teaAge;
		this.teaSex = teaSex;
		this.courseName = courseName;
	}
	/**
	 * 因为有了自定义的构造方法，则jvm提供的默认的构造方法失效，需要将默认的构造方法的显式写出；
	 */
	public Teacher() {
		
		System.out.println("执行力默认的构造方法。。。。");
		
	}


	// 行为方法
	/**
	 * 方法重载：
	 * @param object 
	 * @param j 
	 * @param i 
	 * @param string 
	 */
	
	/**
	 * 方法重载：个数不同
	 * 
	 * @param num
	 */
	private void doTeaching(int num) {
		System.out.println(this.getTeaName() + "is teaching " + num + " 门课程");
	}

	/**
	 * 方法重载：类型不同
	 * 
	 * @param where
	 */
	public void doTeaching(String where) {
		System.out.println(this.getTeaName() + "is teaching " + this.getCourseName() + " at " + where);
	}

	/**
	 * 方法重载：个数不同
	 * 
	 * @param wh
	 * @param num
	 */
	public void doTeaching(String where, int num) {
		System.out.println(this.getTeaName() + "is teaching " + this.getCourseName() + " at " + where);
	}

	/**
	 * 方法重载：顺序不同
	 * 
	 * @param wh
	 * @param num
	 */
	public void doTeaching(int num, String where) {
		System.out.println(this.getTeaName() + "is teaching " + this.getCourseName() + " at " + where);
	}

	/**
	 * 方法重载：个数不同、类型不同
	 * 
	 * @param wh
	 * @param num
	 */
	public void doTeaching(String shoolName, String where) {
		System.out.println(this.getTeaName() + "is teaching " + this.getCourseName() + " at " + where);
	}

	/**
	 * 方法重载：顺序不同【本质是：顺序相同，参数名不同而已】
	 * 
	 * @param wh
	 * @param num
	 */
	/*
	 * public void doTeaching(String where, String shoolName) {
	 * System.out.println(this.getTeaName() + "is teaching " + this.getCourseName()
	 * + " at " + where); }
	 */

	/**
	 * 变长参数：
	 * @param where
	 * @param shoolName
	 */
	 public void doTeaching(String where, String ...shoolName) {
		 System.out.println("变长参数方法：");
	     System.out.println(this.getTeaName() + "is teaching " + this.getCourseName()
	 + " at " + where); 
	 
	 //变长参数的使用
	 if (shoolName != null) {
			for (String string : shoolName) {
				System.out.print(string + " ");
			}
			System.out.println();
		}
	}

	 /**
		 * 变长参数：
		 * @param where
		 * @param shoolName
		 */
		 public void doTeaching(String where, int num,int stuName,String []shoolName) {
			
			 System.out.println("变长参数方法：");
		     System.out.println(this.getTeaName() + "is teaching " + this.getCourseName()
		 + " at " + where); 
		 
		 //变长参数的使用
		 if (shoolName != null) {
				for (String string : shoolName) {
					System.out.print(string + " ");
				}
				System.out.println();
			}
		}

		 

	
	 
	 
	 // getter/setter方法接口
	public String getTeaName() {
		return teaName;
	}

	public void setTeaName(String teaName) {
		this.teaName = teaName;
	}

	public int getTeaAge() {
		return teaAge;
	}

	public void setTeaAge(int teaAge) {
		this.teaAge = teaAge;
	}

	public String getTeaSex() {
		return teaSex;
	}

	public void setTeaSex(String teaSex) {
		this.teaSex = teaSex;
	}

	public String getCourseName() {
		return courseName;
	}

	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}

}
